package com.mhg.collection.theSet;

import java.util.ArrayList;
import java.util.LinkedHashSet;

public class Demo_LinkedHashSet {

	public static void main(String[] args) {
		LinkedHashSet lhs = new LinkedHashSet();
		lhs.add("java01");
		lhs.add("java04");
		lhs.add("java02");
		lhs.add("java09");
		lhs.add("java02");
		System.out.println(lhs);
		
		//排重
		
		ArrayList list = new ArrayList();
		list.add("a");
		list.add("a");
		list.add("b");
		list.add("a");
		System.out.println(list);
		LinkedHashSet lhs2 = new LinkedHashSet();
		lhs2.addAll(list);
		System.out.println(lhs2);
		list.clear();//清空元集合
		list.addAll(lhs2);//将排重后的集合 再扔回去
		System.out.println(list);
	}

}
